<div class='fui-page fui-page-current'>
<div class="fui-content">
		<div class="fui-picture">
				<a style="display: block;" data-nocache="true">
					<img ng-src="{{tomedia(pagedata.systemxieyi.vipbg) || '../core/resource/images/nopic.jpg'}}">
				</a>
		</div>
		<div class="fui-cell-group fui-cell-click" style="padding-bottom:0.3rem;margin-top:0">
			<div class="fui-cell">
				<div class="fui-cell-label" style='width:auto' >付费方式</div>
				<div class="fui-cell-text"> 
				<span ng-click="pagedata.type(1);" ng-class="{'jylabel jylabel-red':1,'active':pagedata.post.paytype==1}" style="margin-right:10px">按月支付</span>
				<span ng-click="pagedata.type(2);" ng-class="{'jylabel jylabel-red':1,'active':pagedata.post.paytype==2}" style="margin-right:10px">按季支付</span>
				<span ng-click="pagedata.type(3);" ng-class="{'jylabel jylabel-red':1,'active':pagedata.post.paytype==3}">按年支付</span></div>
			</div>
			<div class="fui-cell">
				<div class="fui-cell-label" style='width:auto' >开通时长</div>
				<div ng-if="pagedata.post.paytype==1" class="fui-cell-text">1个月</div>
				<div ng-if="pagedata.post.paytype==2"  class="fui-cell-text" >1个季度</div>
				<div ng-if="pagedata.post.paytype==3" class="fui-cell-text">1年</div>
			</div>
			<div class="fui-cell">
				<div class="fui-cell-label" style='width:auto' >费用合计：</div>
				<div class="fui-cell-text bold" style="color:red"> ￥{{pagedata.fee || '0.00'}}</div>
			</div>
		</div>
		<div class="weui_cells_checkbox" style="margin-top:2rem">
                <div class="fui-cell-label" style="text-align:center;margin:0 auto;padding:0.2rem">
                    <input type="checkbox" class="fui fui-checkbox fui-checkbox-danger verify-checkbox" style="line-height:0.6rem" ng-checked="pagedata.post.checked==true" ng-model="pagedata.post.checked">
					我已阅读并同意《<a ng-click="pagedata.show_xieyi=true" style="color:f60">会员协议</a>》
                </div>
        </div>
		<div class="weui_btn_area" style="margin-top:0">
			 <a class="weui_btn weui_btn_primary" href="javascript:" id="showTooltips" ng-click="pagedata.buyvip();">提交</a>
		</div>
</div>
<div ng-if="pagedata.show_xieyi" class="popup">
	<div class="popup-body">
		<div class="popup-bottom">
		<i class="closed icon icon-cuowu" ng-click="pagedata.show_xieyi=false"></i>
		<div class="content-images" style="padding:0.5rem;height:20rem; overflow-y:scroll;">
					<div class="title bold" style="font-size:0.8rem">{{pagedata.xieyi.title || '平台声明'}} / <small>Read Ggree</small></div>
					<div class="text" style="padding-top:0.5rem;font-size:0.7rem" ng-bind-html="trust(pagedata.xieyi.content)">
					</div>
		</div>
		<div class="modal-footer">
				<div ng-click="pagedata.show_xieyi=false;pagedata.post.check=1;" class="mod-check" style="width: 100%; margin: 0;">我已阅读</div>
		</div>
		</div>
	</div>
</div>
<script type="text/javascript">
//购买
scope.pagedata.buyvip=function(){
	if(!scope.pagedata.post.checked){
		scope.message('请先阅读并勾选《会员协议》','error');
		return false;
	}
	scope.post_json('/member.buyvip/post/',scope.pagedata.post,function(result){
		if(result.pay_id){
			scope.pagedata.order_id=result.order_id;
			scope.$evalAsync();
			scope.tool.pay(result.pay_id,function(res){
						if(res.type=='success'){
							scope.message('支付成功！','','/member.index/');
							
						}else{
							scope.message('支付失败！失败原因：'+res.message,'error');
						}
			},'','','/member.index/','/member.index/');
		}
	});
	return
}
//选择付款类型
scope.pagedata.type=function(type){
	scope.pagedata.post.paytype = type;
	scope.pagedata.jisuan(type);
	return
}
//计算
scope.pagedata.jisuan=function(type){
	console.log(type);
	if(type ==1){
		scope.pagedata.fee = (scope.pagedata.level.fee_open1)
	}else if(type ==2){
		scope.pagedata.fee = (scope.pagedata.level.fee_open2)
	}else if(type ==3){
		scope.pagedata.fee = (scope.pagedata.level.fee_open)
	}
	scope.$evalAsync();
}
</script>
</div>